<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Golang," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="因为缺乏接口编程经验，所以一直对Interface理解有些困惑，觉得既然我继承来之后也要全部实现，那么为什么不直接自己定义这些方法？而且也不理解为什么说go语言的Interface设计是颠覆性的。刚才静下心来好好研究了一下接口以及实现案例，终于豁然开朗。">
<meta property="og:type" content="article">
<meta property="og:title" content="Go语言关于Interface的理解与思考">
<meta property="og:url" content="/2017/02/05/Go语言关于Interface的理解与思考/index.html">
<meta property="og:site_name" content="Porson's Bolg">
<meta property="og:description" content="因为缺乏接口编程经验，所以一直对Interface理解有些困惑，觉得既然我继承来之后也要全部实现，那么为什么不直接自己定义这些方法？而且也不理解为什么说go语言的Interface设计是颠覆性的。刚才静下心来好好研究了一下接口以及实现案例，终于豁然开朗。">
<meta property="og:updated_time" content="2017-02-23T03:31:11.750Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Go语言关于Interface的理解与思考">
<meta name="twitter:description" content="因为缺乏接口编程经验，所以一直对Interface理解有些困惑，觉得既然我继承来之后也要全部实现，那么为什么不直接自己定义这些方法？而且也不理解为什么说go语言的Interface设计是颠覆性的。刚才静下心来好好研究了一下接口以及实现案例，终于豁然开朗。">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"right","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 'porson',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="/2017/02/05/Go语言关于Interface的理解与思考/"/>





  <title> Go语言关于Interface的理解与思考 | Porson's Bolg </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-right page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta custom-logo">
  
    <div class="site-meta-headline">
      <a>
        <img class="custom-logo-image" src="/images/favicon.png"
             alt="Porson's Bolg"/>
      </a>
    </div>
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">Porson's Bolg</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
    
      <p class="site-subtitle">MySQL/Python/Golang/Others</p>
    
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user-md"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="/2017/02/05/Go语言关于Interface的理解与思考/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="Porson">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="Porson's Bolg">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="Porson's Bolg" src="/images/favicon.png">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Go语言关于Interface的理解与思考
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2017-02-05T23:21:35+08:00">
                2017-02-05
              </time>
            

            

            
          </span>

          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/02/05/Go语言关于Interface的理解与思考/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2017/02/05/Go语言关于Interface的理解与思考/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>因为缺乏接口编程经验，所以一直对Interface理解有些困惑，觉得既然我继承来之后也要全部实现，那么为什么不直接自己定义这些方法？而且也不理解为什么说go语言的Interface设计是颠覆性的。<br>刚才静下心来好好研究了一下接口以及实现案例，终于豁然开朗。<br><a id="more"></a></p>
<h3 id="什么是接口（Interface）"><a href="#什么是接口（Interface）" class="headerlink" title="什么是接口（Interface）"></a>什么是接口（Interface）</h3><p>其实说白了，接口就是类与类之间的一种协议，统一一个标准。你要调用我，那你就必须实现我的这些方法。我不需要知道你是怎么实现的，但是你一定要实现。甚至在Objec-C当中都不叫interface，直接protocol。</p>
<p>关于接口，知呼上有一个人是这么说的</p>
<blockquote>
<p>接口就是个招牌。</p>
<p>比如说你今年放假出去杭州旅游，玩了一上午，你也有点饿了，突然看到前面有个店子，上面挂着KFC，然后你就知道今天中饭有着落了。</p>
<p>KFC就是接口，我们看到了这个接口，就知道这个店会卖炸鸡腿（实现接口）。</p>
<p>那么为神马我们要去定义一个接口涅，这个店可以直接卖炸鸡腿啊（直接写实现方法），是的，这个店可以直接卖炸鸡腿，但没有挂KFC的招牌，我们就不能直接简单粗暴的冲进去叫服务员给两个炸鸡腿了。</p>
<p>要么，我们就要进去问，你这里卖不卖炸鸡腿啊，卖不卖汉堡啊，卖不卖圣代啊（这就是反射）。很显然，这样一家家的问实在是非常麻烦（反射性能很差）。<br>要么，我们就要记住，中山路108号卖炸鸡，黄山路45号卖炸鸡（硬编码），很显然这样我们要记住的很多很多东西（代码量剧增），而且，如果有新的店卖炸鸡腿，我们也不可能知道（不利于扩展）。</p>
</blockquote>
<p>作者：<a href="https://www.zhihu.com/question/20111251/answer/16585393" target="_blank" rel="external">Ivony链接</a></p>
<h3 id="到底有什么用？"><a href="#到底有什么用？" class="headerlink" title="到底有什么用？"></a>到底有什么用？</h3><p>我相信不少刚接触interface的人会跟我有一样的疑惑，我实现接口跟不实现接口没什么区别啊？反正都要实现这些方法。</p>
<p>问题的误区就在于，接口的使用并不是单人开发模式的。</p>
<p>刚才那个知呼答案下面的一个不是特别高票的答案我感觉更能解释这个问题。</p>
<blockquote>
<p>你写接口你写实现，就不用写接口了。<br>我写接口你实现，接口不就用上了。我不给你规定好了，你怎么知道该实现哪些内容呢。<br>更进一步，我写接口你实现，你今天不在，我明天出差，程序后天交工，那我今天必须把调用这个接口的代码写好。所以就需要接口中有函数，有明确的函数签名。我写个接口，再把调用函数写好，明天你把接口实现了，传个实例进来，交工。<br>interface换个叫法就是contract，有点合同的意思。A实现了这个接口，代表A<strong>承诺</strong>能做某些事情。<br>B需要一些能做某些事情的东西，于是B要求，必须实现了A接口，才能被我调用。实际上也就是个“规范”。</p>
</blockquote>
<p>作者：<a href="https://www.zhihu.com/question/20111251/answer/36219434" target="_blank" rel="external">nonesuccess链接</a></p>
<p>用Go的文法举个例子，排序。</p>
<figure class="highlight go"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">package</span> main</div><div class="line"><span class="keyword">import</span> (</div><div class="line">    <span class="string">"fmt"</span></div><div class="line">)</div><div class="line"><span class="keyword">type</span> Sorter <span class="keyword">interface</span> &#123;</div><div class="line">    Len() <span class="keyword">int</span></div><div class="line">    Less(i, j <span class="keyword">int</span>) <span class="keyword">bool</span></div><div class="line">    Swap(i, j <span class="keyword">int</span>)</div><div class="line">&#125;</div><div class="line"><span class="keyword">type</span> Xi []<span class="keyword">int</span></div><div class="line"><span class="keyword">type</span> Xs []<span class="keyword">string</span></div><div class="line"></div><div class="line"><span class="function"><span class="keyword">func</span> <span class="params">(p Xi)</span> <span class="title">Len</span><span class="params">()</span> <span class="title">int</span></span>               &#123; <span class="keyword">return</span> <span class="built_in">len</span>(p) &#125;</div><div class="line"><span class="function"><span class="keyword">func</span> <span class="params">(p Xi)</span> <span class="title">Less</span><span class="params">(i <span class="keyword">int</span>, j <span class="keyword">int</span>)</span> <span class="title">bool</span></span> &#123; <span class="keyword">return</span> p[j] &lt; p[i] &#125;</div><div class="line"><span class="function"><span class="keyword">func</span> <span class="params">(p Xi)</span> <span class="title">Swap</span><span class="params">(i <span class="keyword">int</span>, j <span class="keyword">int</span>)</span></span>      &#123; p[i], p[j] = p[j], p[i] &#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">func</span> <span class="params">(p Xs)</span> <span class="title">Len</span><span class="params">()</span> <span class="title">int</span></span>               &#123; <span class="keyword">return</span> <span class="built_in">len</span>(p) &#125;</div><div class="line"><span class="function"><span class="keyword">func</span> <span class="params">(p Xs)</span> <span class="title">Less</span><span class="params">(i <span class="keyword">int</span>, j <span class="keyword">int</span>)</span> <span class="title">bool</span></span> &#123; <span class="keyword">return</span> p[j] &lt; p[i] &#125;</div><div class="line"><span class="function"><span class="keyword">func</span> <span class="params">(p Xs)</span> <span class="title">Swap</span><span class="params">(i <span class="keyword">int</span>, j <span class="keyword">int</span>)</span></span>      &#123; p[i], p[j] = p[j], p[i] &#125;</div><div class="line"></div><div class="line"><span class="function"><span class="keyword">func</span> <span class="title">Sort</span><span class="params">(x Sorter)</span></span> &#123;</div><div class="line">    <span class="keyword">for</span> i := <span class="number">0</span>; i &lt; x.Len()<span class="number">-1</span>; i++ &#123;</div><div class="line">        <span class="keyword">for</span> j := i + <span class="number">1</span>; j &lt; x.Len(); j++ &#123;</div><div class="line">            <span class="keyword">if</span> x.Less(i, j) &#123;</div><div class="line">                x.Swap(i, j)</div><div class="line">            &#125;</div><div class="line">        &#125;</div><div class="line">    &#125;</div><div class="line">&#125;</div><div class="line"><span class="function"><span class="keyword">func</span> <span class="title">main</span><span class="params">()</span></span> &#123;</div><div class="line">    ints := Xi&#123;<span class="number">44</span>, <span class="number">67</span>, <span class="number">3</span>, <span class="number">17</span>, <span class="number">89</span>, <span class="number">10</span>, <span class="number">73</span>, <span class="number">9</span>, <span class="number">14</span>, <span class="number">8</span>&#125;</div><div class="line">    strings := Xs&#123;<span class="string">"nut"</span>, <span class="string">"ape"</span>, <span class="string">"elephant"</span>, <span class="string">"zoo"</span>, <span class="string">"go"</span>&#125;</div><div class="line">    Sort(ints)</div><div class="line">    fmt.Printf(<span class="string">"%v\n"</span>, ints)</div><div class="line">    Sort(strings)</div><div class="line">    fmt.Printf(<span class="string">"%v\n"</span>, strings)</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>这样看，是不是就理解接口的意义了。</p>
<h3 id="Go语言接口为什么是颠覆性的？"><a href="#Go语言接口为什么是颠覆性的？" class="headerlink" title="Go语言接口为什么是颠覆性的？"></a>Go语言接口为什么是颠覆性的？</h3><p>在其他编程语言当中，都是谁提供服务，谁提供接口。你需要调用我的服务，就必须声明你实现了我的接口。</p>
<p>翻译成人话就是我的逻辑力调用了一堆不同功能的函数组织，然后通过一些特定逻辑完成了某个功能，别的模块想要调用我这个功能，就必须把我这个功能里使用的这些函数都给实现了。</p>
<p>而这在逻辑上实际是说不通的，服务提供者怎么会确切的知道服务使用者的具体需求呢？当需求发生变化的时候，服务提供者就需要考虑使用者的需求，从而设计接口。而从理论上来说，每一个服务的开发人员都应该专注于自己的服务。</p>
<p>而go语言不同。go语言的接口是<strong>非侵入式接口</strong>，只要调用者本身实现了该接口的全部方法，就默认实现了该接口（事实上也确实是实现了这个接口），而<strong>不需要显示</strong>的声明实现某个接口。这极大的方便了接口的调用，开发人员不必再需要苦想接口的粒度，只需要专注功能函数的实现就可以了。</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Golang/" rel="tag"># Golang</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/02/05/Go语言append函数操作slice时的一个小坑/" rel="next" title="Go语言append函数操作slice时的一个小坑">
                <i class="fa fa-chevron-left"></i> Go语言append函数操作slice时的一个小坑
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/02/06/HTTP协议详解/" rel="prev" title="HTTP协议详解（浏览器信息+服务器信息）">
                HTTP协议详解（浏览器信息+服务器信息） <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>

          
          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2017/02/05/Go语言关于Interface的理解与思考/"
           data-title="Go语言关于Interface的理解与思考" data-url="/2017/02/05/Go语言关于Interface的理解与思考/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="Porson" />
          <p class="site-author-name" itemprop="name">Porson</p>
          <p class="site-description motion-element" itemprop="description">DBA/Python程序员/开源爱好者</p>
        </div>
        <nav class="site-state motion-element">
        
          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">14</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">10</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/porson" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
              <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#什么是接口（Interface）"><span class="nav-number">1.</span> <span class="nav-text">什么是接口（Interface）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#到底有什么用？"><span class="nav-number">2.</span> <span class="nav-text">到底有什么用？</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Go语言接口为什么是颠覆性的？"><span class="nav-number">3.</span> <span class="nav-text">Go语言接口为什么是颠覆性的？</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  <span class="author" itemprop="copyrightHolder">Create by Porson </span>
    <span class="with-love">
    <i class="fa fa-copyright"></i>
  </span>
   2016 - 
  <span itemprop="copyrightYear">2017</span>
  All copyright

</div>



        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"lpx"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  












  
  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

  


</body>
</html>
